#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int a = 0;
    int b = 0;
    for (a = 10000; a < 99999; a++)
    {
        long long sum = 0;
        for (b = 10;(a / b) > 0;b*=10)
        {
            sum += (a % b) * (a / b);
        }
        if (sum == a)
            printf("%d ", a);
    }
    return 0;
}